package model;

public class PotTerm extends ElementarTerm {

	public PotTerm(String varName, String replacedPart) {
		super(varName, replacedPart);
	}

	@Override
	public void execute(VarValueList varValueList) {
		Value result = Value.pot(varValueList.getValue(var1),varValueList.getValue(var2));
		varValueList.setValue(eleTermId, result);
	}

	@Override
	public String toString() {
		return "Pot-Term:"+eleTermId+"="+var1+"^"+var2;
	}
	
	@Override
	public void speedExecute(SpeedVarValueList speedVarValueList) {
		int x=speedVarValueList.internalMap.get(var1);
		int y=1;
		for (int i = 0; i < speedVarValueList.internalMap.get(var2); i++) {
			y = y * x;
		}
		speedVarValueList.setValue(eleTermId, y);
	}
	
}
